//  @ Project : GagalPanen
//  @ File Name : gridmap.hpp
//  @ Date : 3/9/2011
//  @ Author : Denis Irvan
//
//


#if !defined(_GRIDMAP_H)
#define _GRIDMAP_H

#include <string>
#include <vector>
#include <fstream>
#include "map.hpp"
#include "moveablemap.hpp"
#include "grid.hpp"
#include "gameinterface.hpp"
#include "actiontype.hpp"

class GridMap : public Map, public MoveableMap {
public:
  // Normal constructor
  GridMap(GameInterface* game, std::vector<std::string> map);

  // Load game constructor
  GridMap(GameInterface* game, std::ifstream& is);

  virtual ~GridMap();

  virtual void save(std::ofstream& os);

  bool containsCell(Cell* cell);
  void advanceDay();
  void advanceTime();
  Cell* getCellInFrontOff(Cell* cell, Direction dir);
  Cell* getCellAt(int x, int y);
  bool isReachable(
      Cell* init_cell, Direction init_direction,
      Cell* destination_cell, Direction dest_direction);
  std::vector<ActionType> getShortestPathBetween(
      Cell* init_cell, Direction init_direction,
      Cell* destination_cell, Direction dest_direction);
  Grid* getGrid();

  void burnAllPlantableCells();

private:
  std::vector<ActionType> sensitiveShortestPathBetween(
      Cell* init_cell, Direction init_direction,
      Cell* destination_cell, Direction dest_direction);
  Grid grid_;
};

#endif  //_GRIDMAP_H
